<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 't_area.py',
	'<{subtitle}>' => 'Written in <span title="Programming Fundamentals">CS 1101</span> of <a href="http://www.uopeople.edu/">University of the People</a>, finalised on 2017-02-08',
	'<{copyright year}>' => '2017',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img class="framed-centred-image" src="/img/CC_BY-SA_4.0/y.st./coursework/CS1101/t_area.py.png" alt="The output of the program is &quot;96&quot;." width="671" height="183"/>
<blockquote>
<pre># Every good program should begin with a license comment that declares the file
# as being covered by a free software license.
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program. If not, see &lt;https://www.gnu.org./licenses/&gt;.

# These are the dimentions of our triangle.
base = 12
height = 16

# The formula specified by the assignment was this:
#
## area = 1/2 * base * height
#
# However, Python uses integer division if both numbers are integers. Basically,
# that means that:
#
## 1 / 2 == 0
#
# It&apos;s the same as if you used this:
#
## math.floor(1.0 / 2.0)
#
# We could modify the formula to use floating-point decimals instead of
# integers, but that that would have the unintended effect of causing our
# printed value to be a floating-point decimal. In many cases, that would be the
# correct behaviour, but our answer is an integer. We might as well keep it as
# an integer. Instead of changing the formula, we could also use:
#
## from __future__ import division
#
# Again though, this would have the effect of changing our printed integer into
# a floating-point decimal.
area = base * height / 2

# If we&apos;d acquired a floating-point answer instead of an integer answer, we&apos;d
# see &quot;.0&quot; appended to the answer when we printed it.
print area
</pre>
</blockquote>
END
);
